package com.yudean.esb.rest.impl;

import com.yudean.esb.rest.ErpIdsInvTransactionIntPutService;
import com.yudean.esb.service.ErpClientService;
import com.yudean.esb.service.handler.ReceiveErpIdsInvTransactionIntService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service("webErpIdsInvTransactionIntPutServiceImpl")
@Scope("prototype")
public class ErpIdsInvTransactionIntPutServiceImpl implements ErpIdsInvTransactionIntPutService {
    private final static Logger log = LoggerFactory.getLogger(ErpIdsInvTransactionIntPutServiceImpl.class);

    @Resource
    private ErpClientService erpClientService;
    @Resource
    private ReceiveErpIdsInvTransactionIntService receiveErpIdsInvTransactionIntService;

    @Override
    public String putErpIdsInvTransactionIntData(String serviceID, String token, String transactionID, String pkg, String totalPackage, String rollback, String forceReplace, String data) {

        try {
            erpClientService.addErpClientLog(token);
        } catch (Exception e) {
            log.error("save ERP log of /rest/erpidsinvtransactionintput error:", e);
        }

        return receiveErpIdsInvTransactionIntService.putErpIdsInvTransactionIntData(serviceID, token, transactionID, pkg, totalPackage, rollback, forceReplace, data);
    }
}
